#ifndef GAMETABLE_H
#define GAMETABLE_H

#include <QtGui>
#include "player.h"
#include "gamefield.h"

class GameField;

class GameTable : public QWidget
{
    Q_OBJECT
protected:

    int currentPlayerIndex;

    QGridLayout *gridLayout;

    QLine *gameLine;

    void isSquare(QRect& rect);
    bool checkSquares(const QPoint& start);

public:
    QVector<QVector<GameField *> > tableData;

    explicit GameTable(const int& _size = 10, QWidget *parent = 0);

    QVector<Player> players;

    void mousePressEvent(QMouseEvent *e);
    void mouseMoveEvent(QMouseEvent *e);

    void resetTable(int _size = -1);

    Player* currentPlayer() { return &players[currentPlayerIndex]; }

    GET_SET(int, size)


signals:
    void pointChanged();
    void fullTable();
public slots:

};

#endif // GAMETABLE_H
